package com.weibo.util;


import java.util.Calendar;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;



/**
 * 每天晚上00：00开始采集程序
 * @author Administrator
 *
 */
public class WeiboCaijiTimerTask extends TimerTask{
	 //定义组件  
    private Timer timer;  
    
    public  WeiboCaijiTimerTask(){  
   	 //Get the Date corresponding to 11:01:00 pm today.
   	Calendar calendar = Calendar.getInstance();
   	calendar.set(Calendar.HOUR_OF_DAY,00);
   	calendar.set(Calendar.MINUTE, 00);
   	calendar.set(Calendar.SECOND, 00);
   	Date time = calendar.getTime();
   	
   	timer = new Timer();
   	timer.schedule(this, time);
   	
    	  //timer=new Timer();  
          //timer.scheduleAtFixedRate(this, 1*1000, 5*1000000);  //5秒钟后执行，10秒钟执行一条
    }  
    
    public void run() {  
    	System.out.println("微博采集任务开始执行： "+new Date());  
    	//WeiboCaijiService.caiji();
    }  
    
    
    
    public static void main(String[] args) {  
        new WeiboCaijiTimerTask();  
    }  
      
}
